//	ID : pallab81
// 	PROG : 10926
// 	LANG : C++
// 	2011-07-06-23.35.23 Wednesday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long

int grid[200][200];
int N;
inline void read(){
    int i,j,tmp,k;
    memset( grid, -1, sizeof(grid) );
    for(i=1;i<=N;++i){
        scanf("%d",&k);
            for(j=1;j<=k;++j){
                scanf("%d",&tmp);
                grid[i][tmp]=1;
            }
    }
}
inline void flood_fill(){
    int i,j,k;
    for(k=1;k<=N;++k){
        for(i=1;i<=N;++i){
            for(j=1;j<=N;++j){
                    if( grid[i][k]!=-1 && grid[k][j]!=-1  ){
                        grid[i][j]=1;
                    }
            }
        }
    }
}
inline void proc(){
    flood_fill();
    int i,j;
    int retval = -1;
    int max_val = -1;

    for(i=1;i<=N;++i){
        int d=0;
        for(j=1;j<=N;++j){
            if(grid[i][j]!=-1)++d;
        }
        if(d>max_val){
            max_val=d;
            retval=i;
        }

    }
    printf("%d\n",retval);
}

int main(){
    while(scanf("%d",&N) && N!=0 ){
        read();
        proc();
    }

return 0;
}

